package com.chap5.part1;

import java.util.ArrayList;

/**
 * Created by chgm1006 on 15. 3. 18..
 */
public class ListSample {
  public static void main(String[] args) {
    ListSample sample = new ListSample();
    sample.checkArrayList1();
    sample.checkArrayList2();
    System.out.println("sample = " + sample);
  }

  private void checkArrayList1() {
    ArrayList list1 = new ArrayList();
    list1.add(new Object());
    list1.add("ArrayListSample");
    list1.add(new Double(1));
  }

  public void checkArrayList2() {
    ArrayList<String> list = new ArrayList<String>();
    list.add("A");
    list.add("B");
    list.add("C");
    list.add("D");
    list.add("E");
    list.add(1, "A1");

//    for (String tempData : list) {
//      System.out.println(tempData);
//    }

    ArrayList<String> list2 = new ArrayList<String>();
    list2.add("0 ");
    list2.addAll(list);

    for (String tempData : list2) {
      System.out.println(tempData);
    }

  }
}
